package com.zhang.zxx.boot.trans;

import com.github.repository.TransRepositoryFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Configuration;

/**
 * InitBean:
 *
 * @author zhangxiaoxiang
 * @since 2025/01/23
 */
@Configuration
@RequiredArgsConstructor
public class InitBean implements BeanPostProcessor {

    private final DeptTransRepository userTransRepository;
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        TransRepositoryFactory.register(userTransRepository);
        return BeanPostProcessor.super.postProcessAfterInitialization(bean, beanName);
    }
}
